<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 4/12/2024
  Time: 11:53 AM
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
    <button onclick="ajaxGet()">ajaxGet</button>
    <button onclick="ajaxPost()">ajaxPost</button>
    <button onclick="ajax()">ajax</button>

    <script src="/static/jquery-2.1.4.js" type="text/javascript" charset="utf-8"></script>
    <script>
        function ajaxGet(){
            $.get(
                'ajax1',
                {'name':'张三1'},
                function (jsonObj){
                    console.log(jsonObj)
                },
                'json'
            );
        }

        function ajaxPost(){
            $.post(
                'ajax1',
                {'name':'张三2'},
                function (jsonObj){
                    console.log(jsonObj)
                },
                'json'
            );
        }

        function ajax(){
            $.ajax({
                async: true,
                url: '/ajax1',
                type: 'GET',
                data: {'name': '王五'},
                success: function(jsonObj) {
                    console.log(jsonObj);
                },
                dataType: 'json'
            });
        }
    </script>

</body>
</html>
